package com.pioneer.cloudstorage.pojo.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 文件元数据实体类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("file_metadata")
public class FileMetadata  {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long userId;
    private String fileName;
    private String filePath;
    private Long parentId;
    private Integer isDirectory;
    private Long fileSize;
    private String fileMd5;
    private String mimeType;
    private Integer status;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedTime;

    public FileMetadata (Long userId, String fileName, String filePath,
                        Long parentId, Integer isDirectory, Long fileSize,
                        String fileMd5, String mimeType) {
        this.userId = userId;
        this.fileName = fileName;
        this.filePath = filePath;
        this.parentId = parentId;
        this.isDirectory = isDirectory;
        this.fileSize = fileSize;
        this.fileMd5 = fileMd5;
        this.mimeType = mimeType;
        this.status = 1; // 正常状态
    }

}
